package com.xja.service.impl;/**
 * @className: FoodServiceImpl
 * @description: TODO 类描述
 * @author: wkx
 * @date: 2022/4/14
 **/

import com.xja.mapper.FoodMapper;
import com.xja.pojo.Food;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xja.service.FoodService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @ClassName : FoodServiceImpl  //类名

 * @Author : Lenovo //作者
 * @Date: 2022/4/14  9:48
 */
@Service
public class FoodServiceImpl implements FoodService {

    @Autowired
    FoodMapper foodMapper;
    @Override
    public List<Food> getFoodList() {
      return   foodMapper.getFoodList();
    }
    @Autowired
    FoodMapper foodMapper;
    @Override
    public List<Food> getFoodList(Food food, Integer page) {
        PageHelper.startPage(page,5);
        List<Food> foods = foodMapper.selectFood(food);
        PageInfo<Food> pageInfo = new PageInfo<>(foods);
        pageInfo.setPageNum(page);
        return pageInfo.getList();
    }
}
